<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no" />
    <title>touch事件</title>
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/index.css">
    <script src="./js/rem.js"></script>
</head>

<body>
    <div id="app">
        <div class="box"></div>
    </div>
    <script>
        let el = document.querySelector('.box')
        el.addEventListener(
            'touchstart',
            function (e) {
                console.log('触发了touchstart事件')
                console.log(e)
                console.log(this)
                this.style.backgroundColor = 'blue'
            },
            false
        )

        el.addEventListener(
            'touchmove',
            function (e) {
                console.log('触发了touchmove事件')
                console.log(e.changedTouches[0])
                this.style.backgroundColor = 'yellow'
            },
            false
        )

        el.addEventListener(
            'touchend',
            function (e) {
                console.log('触发了touchend事件')
                console.log(e.changedTouches[0])
                this.style.backgroundColor = 'green'
            },
            false
        )
    </script>
</body>

</html>